
#pragma once
#include "WorkThread.h"
#include "BtsPacket.h"
#include "../../../../share/comm_net.h"
#include "../client_struct.h"

class AsynRequest :public CWorkThread
{
public:
	AsynRequest(void);
	~AsynRequest(void);

	int Enque(CBtsPacket& pkt)
	{
		m_deqCondMutex.Lock();
		m_deqReq.push_back(pkt);	
		m_deqCondMutex.Unlock();
		m_deqCondMutex.Signal();
		return 0;
	}

	int Enque(UnitChlList& chls)
	{
		m_deqCondMutex.Lock();
		m_deqReqChl.push_back(chls);	
		m_deqCondMutex.Unlock();
		m_deqCondMutex.Signal();
		return 0;
	}

	int RequestChlInfo(const UnitChlList& chls);
private:
	int ThreadEntry();
	int Request(CBtsPacket& pkt);
	//int RequestChls(const ParallelInfo& chls );

	int End()
	{
		m_deqCondMutex.Lock();
		m_deqCondMutex.Signal();
		m_deqCondMutex.Unlock();
		Wait();
		return 0;
	}

	std::deque<CBtsPacket> m_deqReq;
	std::deque<UnitChlList> m_deqReqChl;
	CCondMutex	m_deqCondMutex;
};
